# Lucid is (C) Copyright 2006-2007 by Infiscape Corporation
#
# This file is part of Lucid, a PyOpenSG example application.
#
# Lucid is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Lucid is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program.  If not, see <http://www.gnu.org/licenses/>.

# Plugin base classes
import lucid.util.plugin
import lucid.util.reloader
#import sip

def not_implemented():
   assert False

## Qt uses sip.wrapper as a metaclas.  We want to use auto reloader, so we
## need a combined metaclass
#class meta_ReloaderAndSipWrapper(util.reloader.MetaAutoReloader, sip.wrapper):
#   pass

class IViewPlugin(lucid.util.plugin.Plugin):
   """ Base class for plugins that are views/tools in the viewer. """
   def __init__(self):
      pass
   
   @staticmethod
   def getName():
      not_implemented()
   
   def getViewWidget(self):
      not_implemented()
   
   def getIcon(self):
      return None


class IFcEditorPlugin(lucid.util.plugin.Plugin):
   """ Base class for plugins that are editors field containers."""
   def __init__(self):
      super(IFcEditorPlugin,self).__init__()      
   
   @staticmethod
   def getName():
      not_implemented()
   
   @staticmethod
   def getSupportedFcTypes():
      """ Return the type(s) that we support editing. """
      not_implemented()
   
   def getEditorWidget(self):
      not_implemented()

   def setFieldContainer(self, fc):
      """ Set the fc to edit.  If None, then no editing. """
      not_implemented()


class IFcEditorGroupPlugin(lucid.util.plugin.Plugin):
   """ Base class for plugins that custom group editors
      for generic property tree editing of fcs.
   """
   def __init__(self):
      super(IFcEditorGroupPlugin,self).__init__()      
   
   @staticmethod
   def getName():
      not_implemented()
   
   @staticmethod
   def getSupportedFcTypes():
      """ Return the type(s) that we support editing. """
      not_implemented()
   

class IGraphCreatorPlugin(lucid.util.plugin.Plugin):
   """ Base class for plugins that create new nodes in the graph.
       This can be anything from simple geometry to progmatic data.
   """
   def __init__(self):
      super(IGraphCreatorPlugin,self).__init__()
   
   @staticmethod
   def getName():
      not_implemented()
   
   @staticmethod
   def createGraph(self):
      """ Spawn code to create a graph node and return.
          Note, this could create a node to return and then create a modal dialog
          that keeps editing that data in the graph.
          Return None to mean nothing created.
      """
      not_implemented()
      
